import { createStore } from 'vuex';

const store = createStore({
    state() {
        return {
            //用户信息的全局变量
            userData: {
                username: '登录',
                password: '123',
                userId:123456789
            },
            roomData:{
                userId:123456789,
                roomName:'默认房间',
                roomId:123456789
            },
            // roomData:{
            //     userId:40,
            //     roomName:'fakeRoom',
            //     roomId:10086
            // }
            socketState:false
        };
    },
    mutations: {
        setUserData(state, value) {
            state.userData = value;
        },
        setRoomData(state,value){
            state.roomData = value;
        },
        setSocketState(state,value){
            state.socketState = value;
        }
    },
});

export default store;